import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { AddressItem } from '@/types/address'

export const useAddressStore = defineStore('address', () => {
  // state
  const selectedAddress = ref<AddressItem>() // 确认订单页+地址管理页-当前选中的收货地址

  // actions
  function changeSelectedAddress(value: AddressItem) {
    selectedAddress.value = value
  }

  return {
    selectedAddress,
    changeSelectedAddress,
  }
})
